package codingforgreat.lchot150;

public class Lc171 {
    public int titleToNumber(String columnTitle) {
        char[] str = columnTitle.toCharArray();
        int num = 0;
        int dit = 1;
        int res = 0;
        for(int i = str.length - 1;i >= 0;i--){
            num = str[i] - 'A' + 1;
            res += num * dit;
            dit *= 26;
        }
        return res;

    }
}
